# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-mpi4py
pkgver=3.1.5
pkgrel=1
pkgdesc="Python bindings for MPI"
url="https://github.com/mpi4py/mpi4py"
arch="all"
license="BSD-2-Clause"
makedepends="
	openmpi
	openmpi-dev
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://github.com/mpi4py/mpi4py/releases/download/$pkgver/mpi4py-$pkgver.tar.gz"
options="!check" # Fails to collect tests
builddir="$srcdir/mpi4py-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
04da1d6daf66cc86fa3ec574eea6e01749f895035e3394afbc68d6245394c5b03557ede0bda3642b06d9c6ff2c1e6e878a6c8c30d3fa3491392e2e13b82cdec8  mpi4py-3.1.5.tar.gz
"
